import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import "element-plus/dist/index.css";
let app = createApp(App);

// icon图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 注册全局自定义指令
app.directive("permission", {
  mounted(el, binding) {
    // console.log(el, binding);  el 是当前dom元素  binding是当前dom元素上的属性
    if (!store.getters.permissionMenus.includes(binding.value)) el.remove();
  },
});

app.use(router);
app.use(store);
app.mount("#app");
